package com.common.app.utls

import com.common.base.utils.LogUtils
import io.reactivex.rxjava3.core.Observer
import io.reactivex.rxjava3.disposables.Disposable

abstract class SamplerObserver<T : Any>(private var compositeDisposable: ArrayList<Disposable>) :
    Observer<T> {

    override fun onNext(t: T) {
//        LogUtils.e("SamplerObserver返回T:$t")
        LogUtils.e("SamplerObserver==>成功")
        onSucceed(t)
    }

    override fun onError(e: Throwable) {
        LogUtils.e("SamplerObserver==>失败$e")
    }

    override fun onComplete() {

    }

    override fun onSubscribe(d: Disposable) {
        compositeDisposable.add(d)
    }

    abstract fun onSucceed(data: T)
}